#!/usr/bin/env python3
# -*- coding:utf-8 -*-
###
# File: do_fork.py
# -----
# Description: 多进程
# -----
# Created  By: Aim 2020-02-01 16:08:14
# Modified By: Aim 2020-02-01 17:58:19
# -----
# HISTORY:
# Date      	By	Comments
# ----------	---	----------------------------------------------------------
###

import os
from multiprocessing import Process

# print('Process (%s) start' % os.getpid())

# pid = os.fork()
# if pid == 0:
#     print('I am child process (%s) and my parent is %s.' % (os.getpid(), os.getppid()))
# else:
#     print('I (%s) just created a child process (%s).' % (os.getpid(), pid))


def run_proce(name):
    print('Run child process %s (%s)...' % (name, os.getpid()))


if __name__ == '__main__':
    print('Parent process %s.' % os.getpid())
    p = Process(target=run_proce, args=('test',))
    print('Child process will start.')
    p.start()
    p.join()
    print('Child process end.')
